﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace LCA.Community.Web.Helpers
{
    public static class ImageActionLinkHelper 
    { 
        public static string ImageActionLink(this AjaxHelper helper, string imageUrl, string altText, string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions) 
        { 
            var builder = new TagBuilder("img"); 
            builder.MergeAttribute("src", imageUrl); 
            builder.MergeAttribute("alt", altText); 
            var link = helper.ActionLink("[replaceme]", actionName, controllerName, routeValues, ajaxOptions); 
            return link.ToString().Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing)); 
        } 
    } 
}